<template>
  <el-container class="layout-container">
    <el-aside width="200px">
      <el-menu
        router
        :default-active="$route.path"
        class="el-menu-vertical"
      >
        <el-menu-item index="/">
          <el-icon><HomeFilled /></el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-menu-item index="/departments">
          <el-icon><OfficeBuilding /></el-icon>
          <span>部门管理</span>
        </el-menu-item>
        <el-menu-item index="/employees">
          <el-icon><User /></el-icon>
          <span>员工管理</span>
        </el-menu-item>
        <el-menu-item index="/products">
          <el-icon><Goods /></el-icon>
          <span>商品管理</span>
        </el-menu-item>
        <el-menu-item index="/manufacturers">
          <el-icon><Shop /></el-icon>
          <span>制造商管理</span>
        </el-menu-item>
        <el-menu-item index="/department-products">
          <el-icon><Connection /></el-icon>
          <span>部门商品管理</span>
        </el-menu-item>
        <el-menu-item index="/manufacturer-products">
          <el-icon><Link /></el-icon>
          <span>制造商商品管理</span>
        </el-menu-item>
        <el-menu-item @click="openMonitor">
          <el-icon><Monitor /></el-icon>
          <span>图书管理</span>
        </el-menu-item>
      </el-menu>
    </el-aside>
    <el-container>
      <el-header>
        <h2>百货商店管理系统</h2>
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import {
  HomeFilled,
  OfficeBuilding,
  User,
  Goods,
  Shop,
  Connection,
  Link,
  Monitor
} from '@element-plus/icons-vue'

const openMonitor = () => {
  window.open('http://127.0.0.1:5000', '_blank')
}
</script>

<style scoped>
.layout-container {
  height: 100vh;
}

.el-aside {
  background-color: #304156;
}

.el-menu {
  border-right: none;
}

.el-header {
  background-color: #fff;
  border-bottom: 1px solid #dcdfe6;
  display: flex;
  align-items: center;
}

.el-main {
  background-color: #f0f2f5;
  padding: 20px;
}
</style> 